import UserLoginView from "../views/user/UserLoginView";
import UserRegisterView from "../views/user/UserRegisterView";
import DrawBoard from "../components/DrawBoard";
import BasicLayout from "../layouts/BasicLayout";
import SiderLayout from "../layouts/SiderLayout";
import ArticleNewsView from "../views/ArticleNewsView";
import MdCreateView from "../views/editorViews/mdViews/MdCreateView";
import EmptyLayout from "../layouts/EmptyLayout";
import RouterBeforeEach from "./RouterBeforeEach";
import ArticleMdViewView from "../views/editorViews/mdViews/ArticleMdViewView";
import React from "react";
import MdUpdateView from "../views/editorViews/mdViews/MdUpdateView";
import SlateCreateView from "../views/editorViews/slateViews/SlateCreateView";
import SlateUpdateView from "../views/editorViews/slateViews/SlateUpdateView";
import FriendsView from "../views/FriendsView";
import MineArticleView from "../views/MineArticleView";
import SlateCollaborationView from "../views/editorViews/slateViews/SlateCollaborationView";
import UserInformationView from "../views/user/UserInformationView";

export type Route = {
    path: string,
    name?: string,
    element?: React.ReactNode,
    children?: Route[],
    auth?: boolean,
};
const routes: Route[] = [
    {
        path: '',
        element: <SiderLayout/>,

        children: [
            {
                path: "/news",
                element: <RouterBeforeEach><ArticleNewsView/></RouterBeforeEach>,

            },
            {
                path: "/",
                element: <RouterBeforeEach><ArticleNewsView/></RouterBeforeEach>,
            },
            {
                path: "/friend",
                element: <RouterBeforeEach><FriendsView/></RouterBeforeEach>,
            },
            {
                path: "/article/mine",
                element: <RouterBeforeEach><MineArticleView/></RouterBeforeEach>,
            },
        ]
    },
    {
        path: '',
        element: <EmptyLayout/>,
        children: [
            {
                path: "/user",
                children: [
                    {
                        path: "login",
                        element: <UserLoginView/>,
                    },
                    {
                        path: "register",
                        element: <UserRegisterView/>,
                    },
                ]
            },
            {
                path: "/edit/md",
                element: <RouterBeforeEach><MdCreateView/></RouterBeforeEach>,
            },
            {
                path: "/edit/md/update",
                element: <RouterBeforeEach><MdUpdateView/></RouterBeforeEach>,
            },
            {
                path: "/edit/slate",
                element: <RouterBeforeEach><SlateCreateView/></RouterBeforeEach>,
            },
            {
                path: "/edit/slate/update",
                element: <RouterBeforeEach><SlateUpdateView/></RouterBeforeEach>,
            },
            {
                path: "/edit/slate/update/collaboration",
                element: <RouterBeforeEach><SlateCollaborationView/></RouterBeforeEach>,
            },
        ]
    },
    {
        path: '',
        element: <BasicLayout/>,
        children: [
            {
                path: "/user/information",
                element: <RouterBeforeEach><UserInformationView/></RouterBeforeEach>,
            }
            ,
            {
                path: "/view/md",
                element: <ArticleMdViewView/>,
            },
            {
                path: "/view/slate",
                element: <ArticleMdViewView/>,
            },
        ]
    },
    {
        path: "/draw",
        element: <DrawBoard/>,
    },


];
export default routes;
